/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.proyecto.modelado;

import com.proyecto.datos.EntityPlan;
import java.util.ArrayList;

/**
 *
 * @author mario
 */
public class Plan {

    public Plan() {
    }

    public ArrayList MostrarPlan() {

        ArrayList arry = new ArrayList();
        String cadenaSQL = "select id_plan,nombre_plan "
                + "from PLAN;";
        EntityPlan entPlan = new EntityPlan();
        arry = entPlan.EjecutarConsulta(cadenaSQL);
        entPlan = null;

        return arry;
    }
    
    public String IngresarPlan(String nombrePlan){
        String msj,cadenaSQL;
        EntityPlan entP = new EntityPlan();
        cadenaSQL="insert into PLAN (nombre_plan) "
                + "values ('"+nombrePlan+"');";
        msj = entP.EjecutarComando(cadenaSQL);
        return msj;
    }
    
    
     public String EliminarPlan(int id_plan){
        String msj,cadenaSQL;
        EntityPlan entP = new EntityPlan();
        cadenaSQL="delete from PLAN where id_plan="+id_plan+"";
        msj = entP.EjecutarComando(cadenaSQL);
        return msj;
    }
     
     
      public String modificarPlan(int id_plan,String nombre){
        String msj,cadenaSQL;
        EntityPlan entP = new EntityPlan();
        cadenaSQL="update PLAN set nombre_plan='"+nombre+"' "
                + "where id_plan="+id_plan+";";
        msj = entP.EjecutarComando(cadenaSQL);
        return msj;
    }
}
